﻿using System.Collections.Generic;
using System.Linq;
using HHPS.CreditEducation.DataProvider;

namespace HHPS.CreditEducation.Business
{
    public class UserBusiness
    {
        private readonly CreditEducationDbEntities _dataContex;

        public UserBusiness()
        {
            _dataContex = new CreditEducationDbEntities();
        }

        #region -- User Informations --

        public List<Faculty> GetListFaculties()
        {
            return _dataContex.Faculties.ToList();
        }

        public List<Major> GetListMajorsByFaculty(int facultyId)
        {
            return facultyId > 0 ?
                _dataContex.Majors.Where(m => m.IdFaculty == facultyId).ToList() :
                _dataContex.Majors.ToList();
        }

        #endregion
    }
}